home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / tuneit25 / data.z / Form_Main.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-10-16  |  11.3 KB  |  346 lines

  1. VERSION 5.00
  2. Object = "{C5C08340-4E2C-11D0-88EB-444553540000}#2.5#0"; "TUNEIT.OCX"
  3. Begin VB.Form Form_Main 
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Fast Down"
  6.    ClientHeight    =   5430
  7.    ClientLeft      =   1335
  8.    ClientTop       =   720
  9.    ClientWidth     =   5070
  10.    Icon            =   "Form_Main.frx":0000
  11.    KeyPreview      =   -1  'True
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    PaletteMode     =   1  'UseZOrder
  15.    ScaleHeight     =   5430
  16.    ScaleWidth      =   5070
  17.    WindowState     =   1  'Minimized
  18.    Begin VB.Timer Timer1 
  19.       Interval        =   800
  20.       Left            =   4200
  21.       Top             =   3840
  22.    End
  23.    Begin VB.Frame Frame_Options 
  24.       Caption         =   "Options "
  25.       Height          =   1452
  26.       Left            =   240
  27.       TabIndex        =   10
  28.       Top             =   1920
  29.       Width           =   3612
  30.       Begin VB.CheckBox Check_AutoRun 
  31.          Caption         =   "R&un at Windows startup"
  32.          Height          =   372
  33.          Left            =   600
  34.          TabIndex        =   6
  35.          Top             =   840
  36.          Value           =   1  'Checked
  37.          Width           =   2892
  38.       End
  39.       Begin VB.CheckBox Check_WarnUser 
  40.          Caption         =   "&Warn before shut down"
  41.          Height          =   372
  42.          Left            =   600
  43.          Picture         =   "Form_Main.frx":0442
  44.          TabIndex        =   5
  45.          Top             =   360
  46.          Value           =   1  'Checked
  47.          Width           =   2892
  48.       End
  49.       Begin VB.Image Image3 
  50.          Height          =   480
  51.          Left            =   120
  52.          Picture         =   "Form_Main.frx":0884
  53.          Top             =   840
  54.          Width           =   480
  55.       End
  56.       Begin VB.Image Image2 
  57.          Height          =   480
  58.          Left            =   120
  59.          Picture         =   "Form_Main.frx":0B8E
  60.          Top             =   360
  61.          Width           =   480
  62.       End
  63.    End
  64.    Begin VB.OptionButton Option_LogOff 
  65.       Height          =   372
  66.       Left            =   3960
  67.       TabIndex        =   9
  68.       Top             =   1320
  69.       Width           =   1092
  70.    End
  71.    Begin VB.OptionButton Option_Restart 
  72.       Height          =   372
  73.       Left            =   3960
  74.       TabIndex        =   8
  75.       Top             =   840
  76.       Width           =   1092
  77.    End
  78.    Begin VB.OptionButton Option_ShutDown 
  79.       Caption         =   "Ctrl + F12"
  80.       Height          =   372
  81.       Left            =   3960
  82.       TabIndex        =   7
  83.       Top             =   360
  84.       Value           =   -1  'True
  85.       Width           =   1092
  86.    End
  87.    Begin VB.CommandButton Button_LogOff 
  88.       Caption         =   "&Log on as a different user"
  89.       Height          =   372
  90.       Left            =   240
  91.       TabIndex        =   4
  92.       Top             =   1320
  93.       Width           =   3612
  94.    End
  95.    Begin VB.CommandButton Button_Restart 
  96.       Caption         =   "&Restart the computer"
  97.       Height          =   372
  98.       Left            =   240
  99.       TabIndex        =   3
  100.       Top             =   840
  101.       Width           =   3612
  102.    End
  103.    Begin VB.CommandButton Button_Exit 
  104.       Caption         =   "E&xit"
  105.       Height          =   372
  106.       Left            =   2160
  107.       TabIndex        =   1
  108.       Top             =   4920
  109.       Width           =   1692
  110.    End
  111.    Begin VB.CommandButton Button_ShutDown 
  112.       Caption         =   "&Shut down the computer"
  113.       Height          =   372
  114.       Left            =   240
  115.       TabIndex        =   2
  116.       Top             =   360
  117.       Width           =   3612
  118.    End
  119.    Begin VB.CommandButton Button_About 
  120.       Caption         =   "&About"
  121.       Height          =   372
  122.       Left            =   240
  123.       TabIndex        =   0
  124.       Top             =   4920
  125.       Width           =   1692
  126.    End
  127.    Begin VB.Label Label1 
  128.       Appearance      =   0  'Flat
  129.       BackColor       =   &H00000000&
  130.       Caption         =   "Label1"
  131.       ForeColor       =   &H80000008&
  132.       Height          =   12
  133.       Left            =   240
  134.       TabIndex        =   13
  135.       Top             =   4680
  136.       Width           =   3612
  137.    End
  138.    Begin VB.Label Label_Elapsed 
  139.       ForeColor       =   &H00800000&
  140.       Height          =   372
  141.       Left            =   240
  142.       TabIndex        =   12
  143.       Top             =   4200
  144.       Width           =   3732
  145.    End
  146.    Begin VB.Label Label_User 
  147.       Caption         =   "Windows user name"
  148.       ForeColor       =   &H00008000&
  149.       Height          =   372
  150.       Left            =   240
  151.       TabIndex        =   11
  152.       Top             =   3840
  153.       Width           =   3732
  154.    End
  155.    Begin TuneItLib.TuneIt TuneIt1 
  156.       Left            =   4200
  157.       Top             =   4680
  158.       _Version        =   131077
  159.       _ExtentX        =   1270
  160.       _ExtentY        =   1207
  161.       _StockProps     =   64
  162.       BeginProperty CaptionFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  163.          Name            =   "MS Sans Serif"
  164.          Size            =   8.25
  165.          Charset         =   178
  166.          Weight          =   700
  167.          Underline       =   0   'False
  168.          Italic          =   0   'False
  169.          Strikethrough   =   0   'False
  170.       EndProperty
  171.       BeginProperty SmallCaptionFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  172.          Name            =   "MS Sans Serif"
  173.          Size            =   8.25
  174.          Charset         =   178
  175.          Weight          =   400
  176.          Underline       =   0   'False
  177.          Italic          =   0   'False
  178.          Strikethrough   =   0   'False
  179.       EndProperty
  180.       BeginProperty StatusFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  181.          Name            =   "MS Sans Serif"
  182.          Size            =   8.25
  183.          Charset         =   178
  184.          Weight          =   400
  185.          Underline       =   0   'False
  186.          Italic          =   0   'False
  187.          Strikethrough   =   0   'False
  188.       EndProperty
  189.       BeginProperty MessageFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  190.          Name            =   "MS Sans Serif"
  191.          Size            =   8.25
  192.          Charset         =   178
  193.          Weight          =   400
  194.          Underline       =   0   'False
  195.          Italic          =   0   'False
  196.          Strikethrough   =   0   'False
  197.       EndProperty
  198.       BeginProperty MenuFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  199.          Name            =   "MS Sans Serif"
  200.          Size            =   8.25
  201.          Charset         =   178
  202.          Weight          =   400
  203.          Underline       =   0   'False
  204.          Italic          =   0   'False
  205.          Strikethrough   =   0   'False
  206.       EndProperty
  207.       BeginProperty IconTitleFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  208.          Name            =   "MS Sans Serif"
  209.          Size            =   8.25
  210.          Charset         =   178
  211.          Weight          =   400
  212.          Underline       =   0   'False
  213.          Italic          =   0   'False
  214.          Strikethrough   =   0   'False
  215.       EndProperty
  216.    End
  217. Attribute VB_Name = "Form_Main"
  218. Attribute VB_GlobalNameSpace = False
  219. Attribute VB_Creatable = False
  220. Attribute VB_PredeclaredId = True
  221. Attribute VB_Exposed = False
  222. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
  223. Const WM_SETHOTKEY = &H32
  224. Const HOTKEYF_SHIFT = 1
  225. Const HOTKEYF_CONTROL = 2
  226. Const HOTKEYF_ALT = 4
  227. Dim HotKey As Long, HotKeyModifier As Long
  228. Private Sub Button_About_Click()
  229.  Form_About.Show 1
  230. End Sub
  231. Private Sub Button_Exit_Click()
  232.  Unload Me
  233. End Sub
  234. Private Sub Set_AutoRun()
  235.  CustomName = "Fast Down"
  236.  If Check_AutoRun.Value = 1 Then
  237.   FullFileName = App.Path + "\" + App.EXEName + ".EXE"
  238.   TuneIt1.AutoRun FullFileName, CustomName
  239.  Else
  240.   TuneIt1.AutoRun "", CustomName
  241.  End If
  242. End Sub
  243. Private Sub Button_LogOff_Click()
  244. '**** If user selected to be warned
  245. '**** before shut down, ask him/her.
  246.  If Check_WarnUser.Value = 1 Then
  247.   If MsgBox("Log on as a different user ?", vbOKCancel + vbExclamation) = vbCancel Then
  248.     Exit Sub
  249.   End If
  250.  End If
  251.  Set_AutoRun
  252. '**** This line logs off the current user
  253. '**** and shows the log on window !!!
  254.  TuneIt1.LogOff
  255. End Sub
  256. Private Sub Button_Restart_Click()
  257. '**** If user selected to be warned
  258. '**** before Restart, ask him/her.
  259.  If Check_WarnUser.Value = 1 Then
  260.   If MsgBox("Restart the computer ?", vbOKCancel + vbExclamation) = vbCancel Then
  261.     Exit Sub
  262.   End If
  263.  End If
  264.  Set_AutoRun
  265. '**** This line reboots the system !!!
  266.  TuneIt1.Reboot
  267. End Sub
  268. Private Sub Button_ShutDown_Click()
  269. '**** If user selected to be warned
  270. '**** before shut down, ask him/her.
  271.  If Check_WarnUser.Value = 1 Then
  272.   If MsgBox("Shut down ?", vbOKCancel + vbExclamation) = vbCancel Then
  273.     Exit Sub
  274.   End If
  275.  End If
  276.  Set_AutoRun
  277. '**** This line shuts down the system !!!
  278.  TuneIt1.ShutDown
  279. End Sub
  280. Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
  281. '''' Check to see if the key is exactly the hot key. ''''
  282.  If KeyCode = HotKey And Shift = HotKeyModifier Then
  283. '''' Which action assigned to the hot key?          ''''
  284. '''' ( Shut down, Windows restart or Log on ... )   ''''
  285.   If Option_ShutDown.Value = True Then
  286.     Button_ShutDown_Click
  287.   ElseIf Option_Restart.Value = True Then
  288.     Button_Restart_Click
  289.   Else
  290.     Button_LogOff_Click
  291.   End If
  292.  End If
  293. End Sub
  294. Private Sub Form_Load()
  295.  Dim RetVal As Long
  296.  '**** Define the application hotkey and a key modifier
  297.  '**** if desired ( Shift, Ctrl or Alt key ).
  298.  HotKey = vbKeyF12
  299.  HotKeyModifier = HOTKEYF_CONTROL
  300.  '**** Use the SendMessage(...) API function to assign
  301.  '**** the hot key to the application's main form.
  302.  RetVal = SendMessage(Me.hwnd, WM_SETHOTKEY, HotKey + HotKeyModifier * &H100, 0)
  303. End Sub
  304. Private Sub Form_Unload(Cancel As Integer)
  305.  Set_AutoRun
  306. End Sub
  307. Private Sub Image2_Click()
  308. '**** Changing the state of the "Warn before shut down" check box.
  309.  If Check_WarnUser.Value = 0 Then
  310.   Check_WarnUser.Value = 1
  311.  Else
  312.   Check_WarnUser.Value = 0
  313.  End If
  314. End Sub
  315. Private Sub Image3_Click()
  316. '**** Changing the state of the "Run at Windows start" check box.
  317.  If Check_AutoRun.Value = 0 Then
  318.   Check_AutoRun.Value = 1
  319.  Else
  320.   Check_AutoRun.Value = 0
  321.  End If
  322. End Sub
  323. Private Sub Option_LogOff_Click()
  324.  Option_ShutDown.Caption = ""
  325.  Option_Restart.Caption = ""
  326.  Option_LogOff.Caption = "Ctrl + F12"
  327. End Sub
  328. Private Sub Option_Restart_Click()
  329.  Option_ShutDown.Caption = ""
  330.  Option_Restart.Caption = "Ctrl + F12"
  331.  Option_LogOff.Caption = ""
  332. End Sub
  333. Private Sub Option_ShutDown_Click()
  334.  Option_ShutDown.Caption = "Ctrl + F12"
  335.  Option_Restart.Caption = ""
  336.  Option_LogOff.Caption = ""
  337. End Sub
  338. Private Sub Timer1_Timer()
  339. '**** This timer is used to show the elapsed
  340. '**** time since Windows has been started.
  341.   ElapsedTime = Format(Now - TuneIt1.WindowsStartupTime, "hh:nn:ss")
  342.   Label_Elapsed.Caption = "Elapsed time since Windows start :   " & ElapsedTime
  343. '**** Show the current Windows user...
  344.   Label_User.Caption = "Windows user :    " & TuneIt1.WindowsUserName
  345. End Sub
  346.